<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="com.hertz.appr.service.RobotGang"%>
<%@page import="com.hertz.appr.pojo.db.Robot"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String uid = request.getParameter("uid");
String nick = request.getParameter("nick");
String token = request.getParameter("token");
String tokenSecret = request.getParameter("tokenSecret");
String type = request.getParameter("type");
if(uid == null || uid.equals("")){
	response.sendRedirect("../index.jsp");
}
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletConfig().getServletContext());
RobotGang robotGang = (RobotGang)ctx.getBean("robotGang");
Robot robot = new Robot();
robot.setAccessSecret(tokenSecret);
robot.setAccessToken(token);
robot.setCreateTime(System.currentTimeMillis());
robot.setFlag(Short.valueOf(type));
robot.setNick(nick);
robot.setProvider(request.getParameter("provider"));
robot.setUid(uid);
robotGang.save2DB(robot);
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'add_robot_ok.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
   		add ok
  </body>
</html>
